package com.sangmo.fts.training.model;

import com.sangmo.boot.framework.data.entity.general.SoftDeleteEntity;
import com.sangmo.boot.framework.data.json.meta.ExtView;
import com.sangmo.boot.framework.data.json.meta.One;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataField;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataView;
import com.sangmo.fts.common.IConstants;
import com.sangmo.fts.teacher.model.Examination;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * 业务实例
 */
@Entity
@Table(name = "training")
@DataView
@ExtView
@SQLDelete(
        sql = "UPDATE #{entityName} SET deleted = CURRENT_TIMESTAMP WHERE id = ?"
)
@SQLDeleteAll(
        sql = "UPDATE #{entityName} SET deleted = CURRENT_TIMESTAMP WHERE id = ?"
)
@Where(
        clause = "deleted = 0"
)
public class Training extends SoftDeleteEntity {

    @One(value = "examination", target = Examination.class)
    private Long examinationId;

    private String name;

    @One(value = "team", target = Team.class)
    private Long teamId;

//    @DataField(value = IConstants.DATA_TYPE.LONG, required = true, index = true)
//    private Long userId;

    @DataField(value = IConstants.TRAINING_DATA_TYPE.TRAINING_BUSINESS_TYPE, required = true, index = true)
    private String businessType;

    @DataField(value = IConstants.TRAINING_DATA_TYPE.TRAINING_MODE, required = true, index = true)
    private String mode;

    private Date startTime;

    private Date endTime;

    @DataField(value = IConstants.TRAINING_DATA_TYPE.TRAINING_STATE, required = true, index = true)
    private String state = States.PENDING;

    private String description;

    public Long getExaminationId() {
        return examinationId;
    }

    public void setExaminationId(Long examinationId) {
        this.examinationId = examinationId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getTeamId() {
        return teamId;
    }

    public void setTeamId(Long teamId) {
        this.teamId = teamId;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public interface States {
        String PENDING = "PENDING";
        String COMPLETED = "COMPLETED";
    }

    public interface Modes {
        String INDIVIDUAL = "INDIVIDUAL";
        String TEAM = "TEAM";
    }

    public interface BusinessTypes {
        //存货质押融资
        String INVENTORY_FINANCING = "INVENTORY_FINANCING"; //IF
        //保兑仓融资
        String CONFIRMING_STORAGE_FINANCING = "CONFIRMING_STORAGE_FINANCING";//CSF
        //应收账款质押融资
        String RECEIVABLE_PLEDGE_FINANCING = "RECEIVABLE_PLEDGE_FINANCING";//RPF
        //保理融资(有追索权明保理)
        String FACTORING_FINANCING = "FACTORING_FINANCING";//FF
    }

    public interface IfProcessNodes {
        String IF_CONTRACT_SELLER_CONFIRM_1 = "IF_CONTRACT_SELLER_CONFIRM_1";
        String IF_CONTRACT_BANK_CONFIRM_2 = "IF_CONTRACT_BANK_CONFIRM_2";
        String IF_CONTRACT_STORAGE_CONFIRM_3 = "IF_CONTRACT_STORAGE_CONFIRM_3";
        String IF_WAYBILL_SELLER_SHIP_4 = "IF_WAYBILL_SELLER_SHIP_4";
        String IF_WAYBILL_STORAGE_RECEIVE_5 = "IF_WAYBILL_STORAGE_RECEIVE_5";
        String IF_STOCK_STORAGE_STOCK_6 = "IF_STOCK_STORAGE_STOCK_6";
        String IF_LOAN_SELLER_APPLY_7 = "IF_LOAN_SELLER_APPLY_7";
        String IF_LOAN_BANK_AUDIT_8 = "IF_LOAN_BANK_AUDIT_8";
        String IF_LOAN_BANK_ISSUE_9 = "IF_LOAN_BANK_ISSUE_9";
        String IF_REPAYMENT_SELLER_PAY_10 = "IF_REPAYMENT_SELLER_PAY_10";
        String IF_LOAN_BANK_RECALL_11 = "IF_LOAN_BANK_RECALL_11";
        String IF_LADING_BILL_SELLER_APPLY_12 = "IF_LADING_BILL_SELLER_APPLY_12";
        String IF_LADING_BILL_BANK_CONFIRM_13 = "IF_LADING_BILL_BANK_CONFIRM_13";
        String IF_LADING_BILL_STORAGE_CONFIRM_14 = "IF_LADING_BILL_STORAGE_CONFIRM_14";
        String IF_OUTBOUND_STORAGE_DISPATCH_15 = "IF_OUTBOUND_STORAGE_DISPATCH_15";
        String IF_INBOUND_SELLER_STORE_16 = "IF_INBOUND_SELLER_STORE_16";
    }

    public interface CsfProcessNodes {
        String CSF_CONTRACT_BUYER_CONFIRM_1 = "CSF_CONTRACT_BUYER_CONFIRM_1";
        String CSF_CONTRACT_SELLER_CONFIRM_2 = "CSF_CONTRACT_SELLER_CONFIRM_2";
        String CSF_AGREEMENT_SELLER_CONFIRM_3 = "CSF_AGREEMENT_SELLER_CONFIRM_3";
        String CSF_AGREEMENT_BUYER_CONFIRM_4 = "CSF_AGREEMENT_BUYER_CONFIRM_4";
        String CSF_AGREEMENT_BANK_CONFIRM_5 = "CSF_AGREEMENT_BANK_CONFIRM_5";
        String CSF_AGREEMENT_STORAGE_CONFIRM_6 = "CSF_AGREEMENT_STORAGE_CONFIRM_6";
        String CSF_LOAN_BUYER_APPLY_7 = "CSF_LOAN_BUYER_APPLY_7";
        String CSF_LOAN_BANK_ACCEPT_8 = "CSF_LOAN_BANK_ACCEPT_8";
        String CSF_LOAN_BUYER_DEPOSIT_9 = "CSF_LOAN_BUYER_DEPOSIT_9";
        String CSF_ASSURANCE_STORAGE_CREATE_10 = "CSF_ASSURANCE_STORAGE_CREATE_10";
        String CSF_ASSURANCE_BUYER_CONFIRM_11 = "CSF_ASSURANCE_BUYER_CONFIRM_11";
        String CSF_LOAN_BANK_AUDIT_12 = "CSF_LOAN_BANK_AUDIT_12";
        String CSF_DRAFT_BANK_CREATE_13 = "CSF_DRAFT_BANK_CREATE_13";
        String CSF_WAYBILL_SELLER_SHIP_14 = "CSF_WAYBILL_SELLER_SHIP_14";
        String CSF_WAYBILL_STORAGE_RECEIVE_15 = "CSF_WAYBILL_STORAGE_RECEIVE_15";
        String CSF_STOCK_STORAGE_SUBMIT_16 = "CSF_STOCK_STORAGE_SUBMIT_16";
        String CSF_STOCK_BANK_CONFIRM_17 = "CSF_STOCK_BANK_CONFIRM_17";
        String CSF_REPAYMENT_BUYER_CREATE_18 = "CSF_REPAYMENT_BUYER_CREATE_18";
        String CSF_LOAN_BANK_RECALL_19 = "CSF_LOAN_BANK_RECALL_19";
        String CSF_LADING_BILL_BUYER_COMMIT_20 = "CSF_LADING_BILL_BUYER_APPLY_20";
        String CSF_LADING_BILL_BANK_CONFIRM_21 = "CSF_LADING_BILL_BANK_CONFIRM_21";
        String CSF_LADING_BILL_STORAGE_COMPLETE_22 = "CSF_LADING_BILL_STORAGE_COMPLETE_22";
        String CSF_OUTBOUND_STORAGE_DISPATCH_23 = "CSF_OUTBOUND_STORAGE_DISPATCH_23";
        String CSF_INBOUND_BUYER_STORE_24 = "CSF_INBOUND_BUYER_STORE_24";
    }

    public interface RpfProcessNodes {
        String RPF_CONTRACT_BUYER_CONFIRM_1 = "RPF_CONTRACT_BUYER_CONFIRM_1";
        String RPF_CONTRACT_SELLER_CONFIRM_2 = "RPF_CONTRACT_SELLER_CONFIRM_2";
        String RPF_WAYBILL_SELLER_SHIP_3 = "RPF_WAYBILL_SELLER_SHIP_3";
        String RPF_WAYBILL_BUYER_RECEIVE_4 = "RPF_WAYBILL_BUYER_RECEIVE_4";
        String RPF_LOAN_SELLER_APPLY_5 = "RPF_LOAN_SELLER_APPLY_5";
        String RPF_LOAN_BANK_ACCEPT_6 = "RPF_LOAN_BANK_ACCEPT_6";
        String RPF_PLEDGE_CONTRACT_SELLER_CONFIRM_7 = "RPF_PLEDGE_CONTRACT_SELLER_CONFIRM_7";
        String RPF_PLEDGE_CONTRACT_BANK_CONFIRM_8 = "RPF_PLEDGE_CONTRACT_BANK_CONFIRM_8";
        String PRF_PLEDGE_CONTRACT_BANK_REGISTER_9 = "PRF_PLEDGE_CONTRACT_BANK_REGISTER_9";
        String RPF_PLEDGE_CONTRACT_BUYER_CONFIRM_10 = "RPF_PLEDGE_CONTRACT_BUYER_CONFIRM_10";
        String RPF_LOAN_BANK_AUDIT_11 = "RPF_LOAN_BANK_AUDIT_11";
        String RPF_LOAN_BANK_ISSUE_12 = "RPF_LOAN_BANK_ISSUE_12";
        String RPF_REPAYMENT_BUYER_PAY_13 = "RPF_REPAYMENT_BUYER_PAY_13";
        String RPF_LOAN_BANK_RECALL_14 = "RPF_LOAN_BANK_RECALL_14";
    }

    public interface FfProcessNodes {
        String FF_CONTRACT_BUYER_CONFIRM_1 = "FF_CONTRACT_BUYER_CONFIRM_1";
        String FF_CONTRACT_SELLER_CONFIRM_2 = "FF_CONTRACT_SELLER_CONFIRM_2";
        String FF_WAYBILL_SELLER_SHIP_3 = "FF_WAYBILL_SELLER_SHIP_3";
        String FF_WAYBILL_BUYER_RECEIVE_4 = "FF_WAYBILL_BUYER_RECEIVE_4";
        String FF_LOAN_SELLER_APPLY_5 = "FF_LOAN_SELLER_APPLY_5";
        String FF_LOAN_BANK_AUDIT_6 = "FF_LOAN_BANK_AUDIT_6";
        String FF_FACTORING_CONTRACT_BANK_CONFIRM_7 = "FF_FACTORING_CONTRACT_BANK_CONFIRM_7";
        String FF_FACTORING_CONTRACT_SELLER_CONFIRM_8 = "FF_FACTORING_CONTRACT_SELLER_CONFIRM_8";
        String FF_TRANSFER_APPLY_SELLER_SUBMIT_9 = "FF_TRANSFER_APPLY_SELLER_SUBMIT_9";
        String FF_TRANSFER_APPLY_BANK_CONFIRM_10 = "FF_TRANSFER_APPLY_BANK_CONFIRM_10";
        String FF_TRANSFER_APPLY_BUYER_CONFIRM_11 = "FF_TRANSFER_APPLY_BUYER_CONFIRM_11";
        String FF_LOAN_BANK_ISSUE_12 = "FF_LOAN_BANK_ISSUE_12";
        String FF_REPAYMENT_BUYER_PAY_13 = "FF_LOAN_BUYER_PAY_13";
        String FF_LOAN_BANK_RECALL_14 = "FF_LOAN_BANK_RECALL_14";
        String FF_LOAN_SELLER_PAY_15 = "FF_LOAN_SELLER_PAY_15";

    }
}
